import {  AnimationClip, SpriteFrame } from "cc";
import { StateMachine } from "./StateMachine";
import { setListTrantion } from "../utils";
export default class State {
    animationClip: AnimationClip
    constructor(private fsm: StateMachine, private spriteList: Array<SpriteFrame>, private warpMode: AnimationClip.WrapMode = AnimationClip.WrapMode.Normal,private name: string, private animation_speed: number = 1/20, ) {
        this.init()
    }
    async init() {
        this.animationClip=setListTrantion(this.spriteList, this.name, this.warpMode,this.animation_speed,)
    }

    run() {
        this.fsm.animationComponent.defaultClip = this.animationClip
        this.fsm.animationComponent.play()
    }
}